#include <iostream>
#include <vector>
#include <algorithm>
#include <queue>
using namespace std;
priority_queue<int,vector<int>,greater<int>> q;
int main() {
    int n,k;
    cin >> n >> k;
    for(int i=0;i<n;i++)
    {
        int a;
        cin >> a;
        q.push(a);
    }
    int sum=0;
    while(k)
    {
        int t=q.top();
        q.pop();
        if(k>=t){
            k-=t;
        }else{
            break;
        }
        q.push(2*t);
        sum++;
    }
    cout << sum;
    return 0;
}